import {WidgetClass} from "./widget";
export class WidgetCode extends WidgetClass {
  constructor(options = {}) {
    super(options);
    const {ports} = options;
    if (ports) {
      this.ports = ports;
    } else {
      this.ports = this.assembleDefaultPorts();
    }
  }

  assembleDefaultState(options = {}) {
    const superState = super.assembleDefaultState(options);
    return {
      ...superState,
      values: {
        url: "",
      },
    };
  }

  assembleDefaultPorts() {
    const superState = super.assembleDefaultPorts();
    return {
      ...superState,
      values: [
       ...superState.values,
        {
          name: "地址",
          key: "url",
          type: "string",
          value: null,
        },
      ],
      events: [
        ...superState.events
      ],
    };
  }
}
